/*
package com.yiboshi.rehrs.util;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpHost;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Optional;
import java.util.Set;

*/
/**
 * @author jack 2025/3/17
 *//*

@Slf4j
public class ProxyUtils {


    static String url_api = "http://proxy.siyetian.com/apis_get.html?token=AesJWLNpXU51kaJdXTqV1dNpXRz4ERjlXTn1STqFUeORVQ61EVjhXT6lUMOp2Yw0karlXTUFUe.gN2EDM5EjM0cTM&limit=1&type=0&time=&data_format=json&showTimeEnd=true";
    //{"code":1,"info":"获取成功","data":[{"ip":"59.62.106.148","port":13843,"end_time":"2025-03-17 13:46:39"}]}
    static String key = "myHttpHost";
    static Set<String> hosts = new LinkedHashSet<>();

    public static HttpHost getProxy() {
        HttpHost proxy = getProxy(null);
        if (proxy != null) {
            hosts.add(proxy.getHostName() + ":" + proxy.getPort());
        }
        return proxy;

    }

    public static HttpHost getProxy(String url) {
        url = StrUtil.isBlank(url) ? url_api : url;
        */
/*if (true) {
            return null;
        }*//*

        MyHttpHost byCache10Min = CacheUtils.getByCache10Min(key, MyHttpHost.class);
        if (byCache10Min != null && byCache10Min.getEnd_time().isAfter(LocalDateTime.now())) {
            return byCache10Min.getHttpHost();
        }
        JSONObject jsonObject = JsoupUtils.httpGetJSON(url, null);
        JSONObject hostJSON = Optional.ofNullable(jsonObject)
                .map(o -> o.getJSONArray("data")).filter(o -> o.size() > 0).map(l -> l.getJSONObject(0))
                .orElse(null);
        if (hostJSON == null) {
            log.error("url:{},res:{}", jsonObject);
            return null;
        }
        String ip = hostJSON.getString("ip");
        Integer port = hostJSON.getInteger("port");
        Date end_time = hostJSON.getDate("end_time");
        MyHttpHost myHttpHost = new MyHttpHost(new HttpHost(ip, port), DateUtils.dateToLocalDateTime(end_time).plusSeconds(-20));
        CacheUtils.putByCache10Min("myHttpHost", myHttpHost);
        return myHttpHost.getHttpHost();
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    static class MyHttpHost {
        HttpHost httpHost;
        LocalDateTime end_time;
    }
}
*/
